<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>卡片管理</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link href="${ctx }/css/style.css" type="text/css" rel="stylesheet" />
		<link href="${ctx }/css/page.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx }/js/jquery/jquery-1.6.1.min.js"></script>
		<script type="text/javascript" src="${ctx }/js/util.js"></script>
		<script type="text/javascript">
			$(function() {
				mergeTable("dataTable");

				$("#lnkAddCard").click(function() {
					if(window.showModalDialog("${ctx}/card/toAddCard.action","","status=no;dialogWidth=550px;dialogHeight=550px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise") == "OK") {
						document.location.href = "${ctx}/card/listAllCard.action";
					}
				});
			});

			modifyCard = function(id) {
				if(window.showModalDialog("${ctx}/card/toModifyCard.action?id=" + id,"","status=no;dialogWidth=550px;dialogHeight=550px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise") == "OK") {
					document.location.href = "${ctx}/card/listAllCard.action";
				}
			}

			removeCard = function(id) {
				if (confirm('确认要删除么?')) {
					var url = "${ctx}/card/removeCard.action?id=" + id;

					location.href = url;
				}
			}
		</script>
	</head>
	<body>
		<s:form id="form1" action="listAllCard" method="post" namespace="/card">
			<div>
				<div style="width: 100%; height: 30px; text-align: left;">
					当前位置：卡片管理
				</div>
				<div style="float: left; width: 59%; background-color: #EDDEA0; height: 30px;">
					<b>卡片管理</b>
				</div>
				<div style="float: right; width: 39%; background-color: #EDDEA0; height: 30px;">
					<a href="#" id="lnkAddCard">
						&nbsp;<u>添加卡片</u>
					</a>
				</div>

				<div style="width: 100%; background-color: #FBF7E6">
					<table id="dataTable" cellspacing="2" cellpadding="3" border="1" style="background-color:#DEBA84;border-color:#DEBA84;border-width:1px;border-style:None;width:100%;">
						<thead>
							<tr style="color:White;background-color:#A55129;font-weight:bold; font-size: 11px;">
								<th style="width:12%;">物品名称</th>
								<th>卡片编码</th>
								<th>价格(元)</th>
								<th>卡号</th>
								<th>密码</th>
								<th style="width:12%;">物品描述</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<s:if test="page.data.size() == 0">
								<tr style="color:#000066;background-color:#FFF7E7; font-size: 13px; text-align: center;">
									<td colspan="7">暂无记录显示！</td>
								</tr>
							</s:if>
							<s:else>
								<s:iterator value="page.data" var="data">
									<tr style="color:#000066;background-color:#FFF7E7; font-size: 13px;">
										<td>
											<input type="hidden" name="trid" value='<s:property value="cardTypeName" />' />
											<s:property value="cardTypeName" />
										</td>
										<td>
											<s:property value="id" />
										</td>
										<td>
											<s:property value="price" />
										</td>
										<td>
											<s:property value="cardNo" />
										</td>
										<td>
											<s:property value="cardPwd" />
										</td>
										<td>
											<s:property value="cardDesc" />
										</td>
										<td align="center">
											<span>
												<a href="#" onclick="modifyCard('<s:property value="id" />');">
													<font color="blue">修改</font>
												</a>
												|
												<a href="#" onclick="removeCard('<s:property value="id" />');">
													<font color="blue">删除</font>
												</a>
											</span>
										</td>
									</tr>
								</s:iterator>
							</s:else>
						</tbody>
						<tfoot>
							<tr>
								<td colspan="7" align="center">
									<gc:page pageSize="${page.pageSize}" 
										totalCount="${page.totalCount}" 
										formId="form1" 
										totalPageCount="${page.totalPageCount}" 
										currentPageNo="${page.currentPageNo}" />
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
			</div>
		</s:form>
	</body>
</html>
